// 组件数据
let _comData = {
  currentTab: 0,
  arr :[
    {
      id: 1,
      // icon:"../../../images/nav_icon_01.png",
      title: "最新"
    },
    {
      id: 2,
      // icon:"../../../images/nav_icon_02.png",
      title: "金融"
    },
    {
      id: 3,
      // icon:"../../../images/nav_icon_03.png",
      title: "家教"
    },
    {
      id: 4,
      // icon:"../../../images/nav_icon_04.png",
      title: "培训"
    },
    {
      id: 5,
      //icon:"../../../images/nav_icon_05.png",
      title: "社会"
    },
    {
      id: 6,
      title: "科技"
    },
    {
      id: 7,
      title: "生活"
    },
    {
      id: 8,
      title: "教育"
    }

  ]
}
//组件事件
let _comEvent = {
  swichNav: function (e) {
    console.log(e);
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current,
      })
    }
  }, swiperChange: function (e) {
    console.log(e);
    this.setData({
      currentTab: e.detail.current,
    })

  },
}
//方法
let _comMethod = {
  __lgpanel_show: function () {
    this.setData({ '__lgpanel__.isHide': false })
  },
  __lgpanel_hide: function () {
    this.setData({ '__lgpanel__.isHide': true })
  }
}
//组件类
function LoginPanel() {
  let pages = getCurrentPages()
  let curPage = pages[pages.length - 1]
  //组件中调用页面
  this._page = curPage
  Object.assign(curPage, _comEvent, _comMethod)
  curPage.setData(_comData)

  curPage.loginPanel = this
  return this
}

export { LoginPanel }